using System;
using System.Collections.ObjectModel;
using System.Windows.Automation;
using ProdControls.Bridges;
using ProdControls.Interfaces;
using ProdLogging;

namespace ProdControls
{
    internal sealed class ProdDataGrid : BaseProdControl, IGrid, IGridItem, ISelection, ISelectionItem

    {
        #region Constructors

        /// <summary>
        ///   Initializes a new instance of the ProdDataGrid class.
        /// </summary>
        /// <param name="prodWindow"> The ProdWindow that contains this control. </param>
        /// <param name="automationId"> The UI Automation element </param>
        /// <remarks>
        ///   Will attempt to match AutomationId, then ReadOnly
        /// </remarks>
        public ProdDataGrid(ProdWindow prodWindow, string automationId)
            : base(prodWindow, automationId)
        {
        }

        /// <summary>
        ///   Initializes a new instance of the ProdDataGrid class.
        /// </summary>
        /// <param name="prodWindow"> The ProdWindow that contains this control. </param>
        /// <param name="treePosition"> The index of this control in the parent windows UI control tree. </param>
        public ProdDataGrid(ProdWindow prodWindow, int treePosition)
            : base(prodWindow, treePosition)
        {
        }

        /// <summary>
        ///   Initializes a new instance of the ProdDataGrid class.
        /// </summary>
        /// <param name="controlHandle"> Window handle of the control </param>
        public ProdDataGrid( IntPtr controlHandle)
            : base(controlHandle)
        {
        }

        #endregion Constructors

        #region GridPattern

        /// <summary>
        ///   Retrieves the UI Automation provider for the specified cell
        /// </summary>
        /// <param name="row"> The zero-based row of the desired item. </param>
        /// <param name="column"> The zero-based column of the desired item. </param>
        /// <returns> The desired ProdDataGrid item </returns>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public AutomationElement GetItem(int row, int column)
        {
            return this.GetItemHook(this, row, column);
        }

        /// <summary>
        ///   Gets the total number of columns in the ProdDataGrid
        /// </summary>
        /// <returns> The number of columns </returns>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public int GetColumnCount()
        {
            return this.GetColumnCountHook(this);
        }

        /// <summary>
        ///   Gets the total number of rows in the ProdDataGrid
        /// </summary>
        /// <returns> The number of rows </returns>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public int GetRowCount()
        {
            return this.GetColumnCountHook(this);
        }

        #endregion GridPattern

        #region Grid Item

        /// <summary>
        ///   Gets the number of columns spanned by a cell or item.
        /// </summary>
        /// <param name="dataItem"> The data item. </param>
        /// <returns> Number of columns spanned by a cell or item </returns>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public int GetItemColumnSpan(AutomationElement dataItem)
        {
            return this.GetColumnSpanHook(this, dataItem);
        }

        /// <summary>
        ///   Gets the number of rows spanned by a cell or item.
        /// </summary>
        /// <param name="dataItem"> The data item. </param>
        /// <returns> Number of rows spanned by a cell or item </returns>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public int GetItemRowSpan(AutomationElement dataItem)
        {
            return this.GetRowSpanHook(this, dataItem);
        }

        /// <summary>
        ///   Gets the ordinal number of the row that contains the cell or item.
        /// </summary>
        /// <param name="dataItem"> The data item. </param>
        /// <returns> Number of rows spanned by a cell or item </returns>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public int GetRowIndex(AutomationElement dataItem)
        {
            return this.GetRowHook(this, dataItem);
        }

        /// <summary>
        ///   Gets the ordinal number of the column that contains the cell or item.
        /// </summary>
        /// <param name="dataItem"> The data item. </param>
        /// <returns> Number of column spanned by a cell or item </returns>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public int GetColumnIndex(AutomationElement dataItem)
        {
            return this.GetColumnHook(this, dataItem);
        }

        #endregion Grid Item

        public bool IsSelected
        {
            get { throw new NotImplementedException(); }
        }

        public AutomationElement SelectionContainer
        {
            get { throw new NotImplementedException(); }
        }

        #region IGrid Members

        public int RowCount
        {
            get { throw new NotImplementedException(); }
        }

        public int ColumnCount
        {
            get { throw new NotImplementedException(); }
        }

        #endregion

        #region IGridItem Members

        public int Row
        {
            get { throw new NotImplementedException(); }
        }

        public int Column
        {
            get { throw new NotImplementedException(); }
        }

        public int RowSpan
        {
            get { throw new NotImplementedException(); }
        }

        public int ColumnSpan
        {
            get { throw new NotImplementedException(); }
        }

        public AutomationElement ContainingGrid
        {
            get { throw new NotImplementedException(); }
        }

        #endregion

        #region ISelection Members

        public bool CanSelectMultiple
        {
            get { throw new NotImplementedException(); }
        }

        public bool IsSelectionRequired
        {
            get { throw new NotImplementedException(); }
        }

        public AutomationElementCollection ListItems
        {
            get { throw new NotImplementedException(); }
        }

        public AutomationElement[] SelectedItems
        {
            get { throw new NotImplementedException(); }
        }

        public int ItemCount
        {
            get { throw new NotImplementedException(); }
        }

        public int SelectedItemCount
        {
            get { throw new NotImplementedException(); }
        }

        #endregion

        #region ISelectionItem Members

        public void AddToSelection(string text)
        {
            throw new NotImplementedException();
        }

        public void AddToSelection(int index)
        {
            throw new NotImplementedException();
        }

        public void RemoveFromSelection(string text)
        {
            throw new NotImplementedException();
        }

        public void RemoveFromSelection(int index)
        {
            throw new NotImplementedException();
        }

        public void Select(string text)
        {
            throw new NotImplementedException();
        }

        public void Select(int index)
        {
            throw new NotImplementedException();
        }

        bool ISelectionItem.IsSelected(string text)
        {
            throw new NotImplementedException();
        }

        bool ISelectionItem.IsSelected(int index)
        {
            throw new NotImplementedException();
        }

        public Collection<string> GetSelectedItems()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}